import os
import shutil
import platform


def del_all_pycache_dir(dir_path):
    """删除一个目录下所有的__pycache__文件"""
    for dirpath, dirnames, filenames in os.walk(dir_path):
        for dirname in dirnames:
            if dirname == "__pycache__":
                fullpath = os.path.join(dirpath, dirname)
                shutil.rmtree(fullpath)
                print("del ", fullpath)


if __name__ == "__main__":
    if os.name == "nt":
        del_all_pycache_dir("D:\git_normal_file\stone_cnc")
        del_all_pycache_dir("D:\git_normal_file\hy_four_channels_h")
        del_all_pycache_dir("D:\git_normal_file\new_simu3d")
        del_all_pycache_dir("D:\git_normal_file\qte")
    else:
        del_all_pycache_dir("/usr/local/lib/python3.4/dist-packages/stone_cnc")
        del_all_pycache_dir("/usr/local/lib/python3.4/dist-packages/hy_four_channels")
        del_all_pycache_dir("/usr/local/lib/python3.4/dist-packages/new_simu3d")
        del_all_pycache_dir("/usr/local/lib/python3.4/dist-packages/qte")
